package com.czmh.etc.onlinepubsys.services.impl;

import com.czmh.etc.onlinepubsys.feign.WeiXin.entity.WeiXinUserInfoResponse;
import com.czmh.etc.onlinepubsys.services.WeChatService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;

/**
 * Created by HuangYK on 2019/10/19.
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class WeChatServiceImpl implements WeChatService {

    @Value("${wx.grant_type}")
    private String grant_type;
    @Value("${wx.appid}")
    private String appid;

    @Override
    public void refreshAccessToken() {
        String grantType = "";
        String appid = "";
        String appsecret = "";

        Assert.isTrue(StringUtils.isNotEmpty(grantType), "传入的grantType不能为空！");
        Assert.isTrue(StringUtils.isNotEmpty(appid), "传入的appid不能为空！");
        Assert.isTrue(StringUtils.isNotEmpty(appsecret), "传入的appsecret不能为空！");
    }

    @Override
    public WeiXinUserInfoResponse getUserInfoByAccessToken(String openId) {
        return null;
    }
}
